Say that James wrote out a $300 check to Bob, and that Bob deposited the check in Bob's account.

Answer:

  public static void main( String[] args )
  {
     . . . . . .
    
    int check = 30000;
    account2.processCheck( check );
    account1.processDeposit( check );
    account1.display();
    account2.display();
    
  }

Aliasing (Review)

This is not really part of testing this class, but it is convenient to mention aliasing again. Recall that there can be more than one reference to a given object. Each reference is called an alias. Here is another test program, set up to show this:

class CheckingAccount
{
  . . . . 
}

class CheckingAccountTester
{
  public static void main( String[] args )
  {
    CheckingAccount account1 = new CheckingAccount( "123", "Bob", 100 );
    CheckingAccount account2 = new CheckingAccount( "456", "Jill", 900 );
    CheckingAccount account3; 
    
    account1.display() ;
    account2.display() ;

    account3 = account1;
    account3.display() ;
  }
}

QUESTION 21: